void __init init_frametable(void)
{
-#ifdef __i386__
+#if defined(__i386__)
unsigned long i, p;
+#endif
- frame_table = (struct pfn_info *)FRAMETABLE_VIRT_START;
frame_table_size = max_page * sizeof(struct pfn_info);
frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
+#if defined(__x86_64__)
+ frame_table = __va(alloc_boot_pages(frame_table_size, 4UL << 20));
+#elif defined(__i386__)
+ frame_table = (struct pfn_info *)FRAMETABLE_VIRT_START;
+
for ( i = 0; i < frame_table_size; i += (4UL << 20) )
{
p = alloc_boot_pages(min(frame_table_size - i, 4UL << 20), 4UL << 20);
idle_pg_table[(FRAMETABLE_VIRT_START + i) >> L2_PAGETABLE_SHIFT] =
mk_l2_pgentry(p | __PAGE_HYPERVISOR | _PAGE_PSE);
}
+#endif
memset(frame_table, 0, frame_table_size);
-#endif
}
void arch_init_memory(void)
static unsigned long *alloc_bitmap;
#define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8)
-#define allocated_in_map(_pn) \
-(alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & (1<<((_pn)&(PAGES_PER_MAPWORD-1))))
+#define allocated_in_map(_pn) \
+( !! (alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & \
+ (1UL<<((_pn)&(PAGES_PER_MAPWORD-1)))) )
/*
* Hint regarding bitwise arithmetic in map_{alloc,free}:
if ( curr_idx == end_idx )
{
- alloc_bitmap[curr_idx] |= ((1<<end_off)-1) & -(1<<start_off);
+ alloc_bitmap[curr_idx] |= ((1UL<<end_off)-1) & -(1UL<<start_off);
}
else
{
- alloc_bitmap[curr_idx] |= -(1<<start_off);
- while ( ++curr_idx < end_idx ) alloc_bitmap[curr_idx] = ~0L;
- alloc_bitmap[curr_idx] |= (1<<end_off)-1;
+ alloc_bitmap[curr_idx] |= -(1UL<<start_off);
+ while ( ++curr_idx < end_idx ) alloc_bitmap[curr_idx] = ~0UL;
+ alloc_bitmap[curr_idx] |= (1UL<<end_off)-1;
}
}
if ( curr_idx == end_idx )
{
- alloc_bitmap[curr_idx] &= -(1<<end_off) | ((1<<start_off)-1);
+ alloc_bitmap[curr_idx] &= -(1UL<<end_off) | ((1UL<<start_off)-1);
}
else
{
- alloc_bitmap[curr_idx] &= (1<<start_off)-1;
+ alloc_bitmap[curr_idx] &= (1UL<<start_off)-1;
while ( ++curr_idx != end_idx ) alloc_bitmap[curr_idx] = 0;
- alloc_bitmap[curr_idx] &= -(1<<end_off);
+ alloc_bitmap[curr_idx] &= -(1UL<<end_off);
}
}
pfn_stamp = pg[i].tlbflush_timestamp;
for ( j = 0; (mask != 0) && (j < smp_num_cpus); j++ )
{
- if ( mask & (1<<j) )
+ if ( mask & (1UL<<j) )
{
cpu_stamp = tlbflush_time[j];
if ( !NEED_FLUSH(cpu_stamp, pfn_stamp) )
- mask &= ~(1<<j);
+ mask &= ~(1UL<<j);
}
}